<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/15
 * Time: 10:38
 */

namespace app\admin\controller;


use app\common\controller\Backend;

class Dash extends Backend
{
    /**
     * 今日新增用户
     */
    function today_users(){
        $today_users = db('users')->whereTime('createtime','today')->count();
        return $today_users;
    }

    /**
     * 有效会员数
     */
    function effec_users(){
        $effec_users = db('users')->where('status',1)->count();
        return $effec_users;
    }

    /**
     * 累计会员总量
     */
    function total_users(){
        $total_users = db('users')->count();
        return $total_users;
    }

    /**
     * 普通会员
     */
    function users(){
        $users = db('users')->where('level',1)->count();
        return $users;
    }

    /**
     * Vip会员
     */
    function vip_users(){
        $vip_users = db('users')->where('level',2)->count();
        return $vip_users;
    }

    /**
     * Vip超级会员
     */
    function vip_super_users(){
        $vip_super_users = db('users')->where('level',3)->count();
        return $vip_super_users;
    }

    /**
     * 今日订单统计
     */
    function today_orders(){
        $today_orders = db('orders')->whereTime('createtime','today')->count();
        return $today_orders;
    }

    /**
     * 用户奖学金总计
     */
    function users_balance(){
        $users_balance = db('users')->sum('balance');
        return $users_balance;
    }

    /**
     * 今日订单总金额
     */
    function today_orders_money(){
        $today_orders_money=db('orders')->whereTime('createtime','today')->sum('total_money');
        return $today_orders_money;
    }

    /**
     * 今日提现总金额
     */
    function today_return_cash(){
        $today_return_cash=db('return_cash')->whereTime('create_time','today')->sum('before_money');
        return $today_return_cash;
    }

}